﻿function TaskFactory($http, $q) {

    var GetAllTasks = function () {
        var deferred = $q.defer();
        $http({
            method: 'GET',
            url: '/api/apiTask',
            headers: { Authorization: "Bearer " + localStorage.getItem('token') }
        }).success(function (data) {
            deferred.resolve(data);
        }).error(function (data) {
            deferred.reject(data);
        });
        return deferred.promise;
    }

    return {
        GetAllTasks: GetAllTasks,
    }
}
TaskFactory.$inject = ['$http', '$q'];